package io.gitee.kotle.android.utils

import android.content.Context
import android.widget.Toast
import io.gitee.kotle.android.BaseGlobalConst

/**
 * toast字符串
 */
fun String?.toast(duration: Int = Toast.LENGTH_SHORT, context: Context = BaseGlobalConst.app) {
    this ?: return
    if (isMainThread) {
        Toast.makeText(context, this, duration).show()
    } else {
        postMainHandler {
            Toast.makeText(context, this, duration).show()
        }
    }
}